package deleteface.bank.jqsoft.cn.deleteface.rsa;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.Button;



import java.security.PublicKey;

import cn.jqsoft.bank.deleteface.R;

public class RSATestActivity extends Activity {
    String strpublickey =
            "<RSAKeyValue><Modulus>q2YRby78c7qZOXLiGoG6XqM+3pClyEwqVwAnV6CS/P8TQxeaA74ZGWm7SBgPzz+5JD77puZJxd/QwUAaPDUUQ/eUlaCYTpcDtHdavSBud3B8vTwc7tvQtgJvGpA4VB5YxKr6n7f41KVhyzR5Gvn47AdjsCe6YNUXClQR61ZR9Lk=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>";

//    String strprivatekey =
//            "<RSAKeyValue><Modulus>w9u2HfdbNZrmAUmXPbNmrhfy861qX4mzcCn69Ksl03Nz+Fq9gINZeN/vrfcWBzMyYxb2/J2TnGtpCLc0ls6gOTKDPbnQHwHr3oCzfvxNwvT2uoKQUBl4xMFw0TmvufMbheq6q3FCXUkVkAUC1cbQ/S9DqNp/veYcAavRDXtFdD0=</Modulus><Exponent>AQAB</Exponent><P>6tzaLZmY+hLLAifunWwcdUSfqTUvKOO5bJ8M1Zt34en40tfBaH9zml9gP8cmXaWyfpiZgHlPS9xlkLngudAiJw==</P><Q>1Xw2E1ufXsCM2JZahB6PH9pCgfD4XPjrqxF9xOWVvfbPmVBZByBIHYRs8ifbjIPvSKuaCfVFVStoIcOYrT9I+w==</Q><DP>mS4iPsuHMtM/BND2mEYC6ZkwaTP+5jRgo6+4tzkHH5lyaFHAG1/FDlJWfEJvi3SezmLI+zojtd6xf4s8PvS40Q==</DP><DQ>I91kMEhaM87hWpmXx05i+RTvy2iyMNxYqzqbCHMRfwJxye3npvzTYLIYo23ywl5/2pOJo1ajOTW7nsB/a8uP9Q==</DQ><InverseQ>EtYQvvBViXf7A5bgh+H4xLlBezD0yziBigoP/xcg1mcuI9Kb9rtPq64hQsajDYeNmm0Ibkxz9ihHr8+uWtdi5w==</InverseQ><D>HSivw2RZKvDlv1lSb/gumEqufALcbF7W3SMS3qxAVGvC3z27Ks/jWTCVwWOg3u+LV99KZC+dk1MWbxq/dJhMmBSiHOT6Sg7wvNMmX58zHl7Bhs702henzbr7CkiWrUcy3pVigr4olT9FlkjQkeEu9VfVW4TRGUDUkixTeh9MMC0=</D></RSAKeyValue>";

    PublicKey publicKey = RsaHelper.decodePublicKeyFromXml(strpublickey);
//    PrivateKey privateKey = RsaHelper.decodePrivateKeyFromXml(strprivatekey);
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.test);
        Button testBtn = findViewById(R.id.test_btn);
        testBtn.setOnClickListener(view -> {
            String cotent = "zhongxiafei0829<test>";
            String str = RsaHelper.encryptDataFromStr(cotent, publicKey);
            Log.e("unfind","加密后：" + str);
        });

    }


}
